/**
 * @(#)fenxi.java
 *
 * fenxi application
 *
 * @author 
 * @version 1.00 2014/11/25
 */
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
 import javax.swing.border.*;
 
 
public class fenxi {
    
    public static void main(String[] args) {
         new frame();
    }
}


class frame extends Frame implements ActionListener{
	Button input;
	TextArea fenhou,fenqian;
	Box box;
	
	frame(){
		input=new Button("analysis");
		input.addActionListener(this);
		box=Box.createHorizontalBox();
		fenhou=new TextArea(null);
		fenqian=new TextArea();
		box.add(fenqian);
		box.add(fenhou);
		add(input,BorderLayout.NORTH);
		add(box,BorderLayout.CENTER);
		setBounds(300,300,900,500);
	    setVisible(true);
	    addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent e){
			System.exit(0);}
		});
	    }
	    
	    
		public void actionPerformed(ActionEvent e){
		String s=new String();
		s=fenqian.getText();
		char p[]=new char[255];
		p=s.toCharArray();
	String w=new String();
	String q=new String();
	String r=new String();
	fenhou.setText(null);
		for(int i=0;i<p.length;i++){
			
			int c=1;
			q=fenhou.getText();
		
			String	t=new String(p,i,1);
	
				if(q.indexOf(t)==-1){
			for(int j=i+1;j<p.length;j++){
			
				String	t1=new String(p,j,1);
					
					
					if(t.equals(t1)){
						c++;
					}
				}
				//String	q=String(p,i,1);
		//w=new String(p,i,1);
		String o=new String(":"+c+"  ");
		
			r=r+t+o;
				
			
			fenhou.setText(r);	}
		}

		//String zhuanhuan=new String(r.toString());
		//	fenhou.setText(r);	
	
}
	}
